package com.study.hot.di.dagger.dagger2;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.study.hot.R;
import com.study.hot.di.dagger.dagger2.model.ModuleModel;

/**
 * <pre>
 *     author : slx
 *     time   : 2020/11/25
 *     desc   : Component 依赖
 * </pre>
 */
public class DaggerFragment extends Fragment {

    //    @Inject
    ModuleModel moduleModel;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       /* DaggerDaggerFragmentComponent.builder()
                .daggerActivityComponent2(((DaggerActivity) getActivity()).getDaggerActivityComponent2())
                .build()
                .inject(this);*/
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_dagger, container, false);
        view.findViewById(R.id.btn_daggerfg).setOnClickListener(v -> moduleModel.test2());
        return view;
    }
}
